package org.chengyi.model_shop.controller;

import org.chengyi.model_shop.entity.Cart;
import org.chengyi.model_shop.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping
public class CartController {
    @Autowired
    private CartService cartService;
    @PostMapping("/addCart")
    public String addCart(@RequestBody Cart cart)
    {
        return cartService.addCart(cart);
    }
    @DeleteMapping("/deleteCart")
    public String deleteCart(@RequestParam Integer productId){
        return cartService.deleteCart(productId);
    }
    @GetMapping("/getCartList")
    public List<Cart> getCartList() {
        return cartService.getCartList();
    }

}
